function [newArray pos]=maniArray(x,a)
newArray=[]
pos=[];
if isscalar(a)
    a=a*ones(1,length(x));
end
for i=1:length(x)
    pos=[pos length(newArray)+1];
    tem2=x(i)*ones(a(i),1);
    newArray=[newArray;tem2];
end
